//
//  ViewController.m
//  SDWebImage的使用
//
//  Created by clz on 2019/10/5.
//  Copyright © 2019 clz. All rights reserved.
//

#import "ViewController.h"
#import <UIImageView+WebCache.h>
#import <Masonry.h>

@interface ViewController ()

@property(nonatomic,strong)UIImageView *imageView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.imageView = [[UIImageView alloc]init];
    self.imageView.contentMode = UIViewContentModeScaleAspectFill;
    self.imageView.clipsToBounds = YES;
    [self.view addSubview:self.imageView];
    [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.view);
        make.size.mas_equalTo(CGSizeMake(100, 100));
    }];
    
    NSString *imagePath = @"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1570256904398&di=f20d18f487915f3993c19d2e4953d4e0&imgtype=0&src=http%3A%2F%2Fww2.sinaimg.cn%2Fthumb300%2F7fd664e1jw1faa8o07pluj20m80xbafa.jpg";
    
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:imagePath] placeholderImage:[UIImage imageNamed:@"defaultBanner"]];
    
//    [self.imageView sd_setImageWithURL:[NSURL URLWithString:imagePath] placeholderImage:[UIImage imageNamed:@"defaultBanner"] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
//
//    }];
}


@end
